{include file='default/head' /}
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space1">
        <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">{$title}</div>
                <div class="layui-card-body">

                    <form class="layui-form layui-form-pane" id="form_data">

                        <div class="layui-form-item">
                            <div class="layui-block">
                                <label class="layui-form-label">后台账号</label>
                                <div class="layui-input-block">
                                    <input type="text" name="account" class="layui-input" placeholder="请设置后台登录账号..."
                                           value="{$core['admin_account']}">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-block">
                                <label class="layui-form-label">旧密码</label>
                                <div class="layui-input-block">
                                    <input type="password" name="jiu_pass" class="layui-input"
                                           placeholder="请填写后台登录旧密码...">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-block">
                                <label class="layui-form-label">新密码</label>
                                <div class="layui-input-block">
                                    <input type="password" name="xin_pass" class="layui-input" placeholder="不修改则留空">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-block">
                                <label class="layui-form-label">再次输入</label>
                                <div class="layui-input-block">
                                    <input type="password" name="zai_pass" class="layui-input" placeholder="不修改则留空">
                                </div>
                            </div>
                        </div>
                        <blockquote class="layui-elem-quote layui-quote-nm">
                            如果你只修改后台账号，可不填写新密码。但是为了校验身份，所以旧密码必须填写正确。<br/><a href="">忘记后台密码了怎么办？</a>
                        </blockquote>

                        <button type="button" class="layui-btn layui-btn-lg" id="form_submit">立即修改</button>
                        <button type="reset" class="layui-btn layui-btn-primary layui-btn-lg">重置</button>


                    </form>


                </div>
            </div>
        </div>
    </div>

    <br/>

    <div class="layui-row layui-col-space1">
        <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">{$title}</div>
                <div class="layui-card-body">

                    <form class="layui-form layui-form-pane" id="form_data_aqmm">

                        <div class="layui-form-item">
                            <div class="layui-block">
                                <label class="layui-form-label">旧安全密码</label>
                                <div class="layui-input-block">
                                    <input type="password" name="jiu_pass" class="layui-input"
                                           placeholder="请填写后台登录旧密码...">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-block">
                                <label class="layui-form-label">新安全密码</label>
                                <div class="layui-input-block">
                                    <input type="password" name="xin_pass" class="layui-input"
                                           placeholder="不修改则留空">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-block">
                                <label class="layui-form-label">再次输入</label>
                                <div class="layui-input-block">
                                    <input type="password" name="zai_pass" class="layui-input"
                                           placeholder="不修改则留空">
                                </div>
                            </div>
                        </div>
                        <blockquote class="layui-elem-quote layui-quote-nm">
                            安全密码为敏感操作验证身份，请勿泄露！安全密码必须是6位纯数字！<br/>默认初始密码是：123123<br/><a href="">忘记安全密码了怎么办？</a>
                        </blockquote>

                        <button type="button" class="layui-btn layui-btn-lg" id="form_submit_aqmm">立即修改</button>
                        <button type="reset" class="layui-btn layui-btn-primary layui-btn-lg">重置</button>


                    </form>

                </div>
            </div>
        </div>
    </div>

</div>

    <style id="welcome_style"></style>
    <div class="layui-col-md12">
        <blockquote class="layui-elem-quote layui-quote-nm">{$core['ADMIN_BOTTOM']}</blockquote>
    </div>
    <script>
        layui.use(['form', 'layedit', 'laydate'], function () {
            var form = layui.form
                , layer = layui.layer
                , layedit = layui.layedit
                , laydate = layui.laydate;


            //监听提交
            $('#form_submit').click(function () {
                var Load = layer.load(2, {shade: [0.3, '#000']}); //开始加载
                $.ajax({
                    type: "POST",
                    url: "/admin/pass/setPass",
                    data: $('#form_data').serialize(),
                    dataType: "json",
                    success: function (json) { //SUCCESS
                        var data = $.parseJSON(json);
                        if (data.code == 0) {
                            layer.close(Load); //关闭加载
                            var indexa = layer.msg(data.msg, {time: 1000, icon: 6}, function () {
                                layer.close(indexa);
                                if (data.url != "" && data.url != null) {
                                    window.open(data.url);
                                } else {
                                    window.location.reload();
                                }
                            });
                        } else {
                            layer.close(Load); //关闭加载
                            var indexa = layer.alert(data.msg, {title: data.title, icon: 5}, function () {
                                layer.close(indexa);
                                if (data.url != "" && data.url != null) {
                                    window.location.href = data.url;
                                }
                            })
                        }
                    },
                    error: function () { //ERROR
                        layer.close(Load); //关闭加载
                        layer.msg('系统繁忙');
                    }
                });
            });

            //监听提交
            $('#form_submit_aqmm').click(function () {
                var Load = layer.load(2, {shade: [0.3, '#000']}); //开始加载
                $.ajax({
                    type: "POST",
                    url: "/admin/pass/setAqmm",
                    data: $('#form_data_aqmm').serialize(),
                    dataType: "json",
                    success: function (json) { //SUCCESS
                        var data = $.parseJSON(json);
                        if (data.code == 0) {
                            layer.close(Load); //关闭加载
                            var indexa = layer.msg(data.msg, {time: 1000, icon: 6}, function () {
                                layer.close(indexa);
                                if (data.url != "" && data.url != null) {
                                    window.open(data.url);
                                } else {
                                    window.location.reload();
                                }
                            });
                        } else {
                            layer.close(Load); //关闭加载
                            var indexa = layer.alert(data.msg, {title: data.title, icon: 5}, function () {
                                layer.close(indexa);
                                if (data.url != "" && data.url != null) {
                                    window.location.href = data.url;
                                }
                            })
                        }
                    },
                    error: function () { //ERROR
                        layer.close(Load); //关闭加载
                        layer.msg('系统繁忙');
                    }
                });
            });
        });
    </script>

</body>
</html>